﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Velocity
{
    internal class CodeValidator
    {
        private static List<string> Namespaces = new List<string>() { "console", "" };

        public static Exception ValidateWithSuper(string With)
        {
            if (With.StartsWith("with"))
            {
                if (With.EndsWith(";"))
                {
                    if (Namespaces.Contains(With.Substring(4).Replace(";", "").Trim()))
                    {
                        return null;
                    }
                    else
                    {
                        return new Exception("The namespace does not exist.");
                    }
                }
                else
                {
                    return new Exception("Missing a trailing semi-colon.");
                }
            }
            else
            {
                return new Exception("The super is not a with statment, internal error.");
            }
        }
    }
}
